<template>
	<view class="home-container">
		<!-- 顶部区域 -->
		<view class="header">
			<view class="greeting">
				<text class="greeting-text">Hi, yaqi</text>
				<text class="date-text">Jun 24th, 2025</text>
			</view>
			<view class="avatar" @tap="goToProfile">
				<text class="avatar-text">🌸</text>
			</view>
		</view>
		
		<!-- 搜索框 -->
		<view class="search-section">
			<view class="search-box" @tap="goToSearch">
				<text class="search-icon">🔍</text>
				<text class="search-placeholder">搜索名称，接法名称</text>
			</view>
		</view>
		
		<!-- 功能模块 -->
		<view class="function-section">
			<text class="section-title">舞蹈类别</text>
			<view class="function-grid">
				<view class="function-item" @tap="goToPractice">
					<view class="function-icon" style="background: #FFE4E6;">
						<text class="icon-text">💃</text>
					</view>
					<text class="function-name">古典舞</text>
				</view>
				<view class="function-item" @tap="goToPractice">
					<view class="function-icon" style="background: #E8F4FF;">
						<text class="icon-text">🎭</text>
					</view>
					<text class="function-name">民族舞蹈</text>
				</view>
				<view class="function-item" @tap="goToPractice">
					<view class="function-icon" style="background: #FFF4E6;">
						<text class="icon-text">🎵</text>
					</view>
					<text class="function-name">现代舞</text>
				</view>
				<view class="function-item" @tap="goToPractice">
					<view class="function-icon" style="background: #F0F9FF;">
						<text class="icon-text">✨</text>
					</view>
					<text class="function-name">芭蕾舞</text>
				</view>
			</view>
		</view>
		
		<!-- 人组类 -->
		<view class="group-section">
			<view class="section-header">
				<text class="section-title">人组类</text>
				<text class="more-text">···</text>
			</view>
			
			<!-- 视频卡片列表 -->
			<view class="video-container">
				<scroll-view class="video-list" scroll-x="true" show-scrollbar="false">
					<view class="video-card" @tap="goToCourse">
						<view class="video-thumbnail">
							<image class="video-image" :src="videoImageSrc" mode="aspectFill"></image>
							<view class="video-overlay">
								<text class="video-title">[2025] NO.1-古典舞·水袖飞扬</text>
								<text class="video-subtitle">经典古典舞教学</text>
							</view>
							<view class="video-duration">08:32</view>
						</view>
					</view>
					
					<view class="video-card" @tap="goToCourse">
						<view class="video-thumbnail">
							<image class="video-image" :src="videoImageSrc" mode="aspectFill"></image>
							<view class="video-overlay">
								<text class="video-title">[2025] NO.2-现代舞·律动节拍</text>
								<text class="video-subtitle">现代舞基础动作</text>
							</view>
							<view class="video-duration">12:15</view>
						</view>
					</view>
					
					<view class="video-card" @tap="goToCourse">
						<view class="video-thumbnail">
							<image class="video-image" :src="videoImageSrc" mode="aspectFill"></image>
							<view class="video-overlay">
								<text class="video-title">[2025] NO.3-民族舞·彩云之南</text>
								<text class="video-subtitle">云南民族舞精选</text>
							</view>
							<view class="video-duration">15:48</view>
						</view>
					</view>
					
					<view class="video-card" @tap="goToCourse">
						<view class="video-thumbnail">
							<image class="video-image" :src="videoImageSrc" mode="aspectFill"></image>
							<view class="video-overlay">
								<text class="video-title">[2025] NO.4-芭蕾舞·天鹅湖选段</text>
								<text class="video-subtitle">经典芭蕾舞剧</text>
							</view>
							<view class="video-duration">20:30</view>
						</view>
					</view>
					
					<view class="video-card" @tap="goToCourse">
						<view class="video-thumbnail">
							<image class="video-image" :src="videoImageSrc" mode="aspectFill"></image>
							<view class="video-overlay">
								<text class="video-title">[2025] NO.5-街舞·潮流节拍</text>
								<text class="video-subtitle">流行街舞教学</text>
							</view>
							<view class="video-duration">18:22</view>
						</view>
					</view>
				</scroll-view>
			</view>
		</view>
		
		<!-- 底部导航栏 -->
		<view class="bottom-nav">
			<view class="nav-item active">
				<text class="nav-icon">🏠</text>
				<text class="nav-text">首页</text>
			</view>
			<view class="nav-item" @tap="goToPractice">
				<text class="nav-icon">🎯</text>
				<text class="nav-text">练习</text>
			</view>
			<view class="nav-item" @tap="goToProfile">
				<text class="nav-icon">👤</text>
				<text class="nav-text">个人</text>
			</view>
		</view>
	</view>
</template>

<script>
import images from '../../utils/images.js'

export default {
	name: 'Home',
	data() {
		return {
			// 页面数据
			videoImageSrc: images.bgLogo // 使用统一的图片管理
		}
	},
	methods: {
		goToSearch() {
			uni.navigateTo({
				url: '/pages/search/search'
			});
		},
		goToCourse() {
			uni.navigateTo({
				url: '/pages/course/course'
			});
		},
		goToProfile() {
			uni.navigateTo({
				url: '/pages/profile/profile'
			});
		},
		goToPractice() {
			uni.navigateTo({
				url: '/pages/practice/practice'
			});
		}
	}
}
</script>

<style scoped>
.home-container {
	background: linear-gradient(135deg, #FFE4E6 0%, #FFF0F2 100%);
	min-height: 100vh;
	padding: 0 30rpx 160rpx;
}

.header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 80rpx 0 40rpx;
}

.greeting {
	display: flex;
	flex-direction: column;
}

.greeting-text {
	font-size: 48rpx;
	font-weight: bold;
	color: #333333;
	margin-bottom: 8rpx;
}

.date-text {
	font-size: 28rpx;
	color: #999999;
}

.avatar {
	width: 80rpx;
	height: 80rpx;
	background: #FF6B9D;
	border-radius: 40rpx;
	display: flex;
	align-items: center;
	justify-content: center;
}

.avatar-text {
	font-size: 40rpx;
}

.search-section {
	margin-bottom: 40rpx;
}

.search-box {
	background: #FFFFFF;
	border-radius: 30rpx;
	padding: 24rpx 30rpx;
	display: flex;
	align-items: center;
	box-shadow: 0 4rpx 20rpx rgba(255, 107, 157, 0.1);
}

.search-icon {
	font-size: 32rpx;
	margin-right: 20rpx;
	color: #999999;
}

.search-placeholder {
	font-size: 28rpx;
	color: #CCCCCC;
}

.function-section {
	margin-bottom: 40rpx;
}

.section-title {
	font-size: 32rpx;
	font-weight: bold;
	color: #333333;
	margin-bottom: 30rpx;
	display: block;
}

.function-grid {
	display: flex;
	justify-content: space-between;
}

.function-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	width: 140rpx;
	transition: transform 0.2s ease;
}

.function-item:active {
	transform: scale(0.95);
}

.function-icon {
	width: 120rpx;
	height: 120rpx;
	border-radius: 30rpx;
	display: flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 20rpx;
	transition: transform 0.2s ease;
}

.function-icon:active {
	transform: scale(0.9);
}

.icon-text {
	font-size: 50rpx;
}

.function-name {
	font-size: 24rpx;
	color: #666666;
	text-align: center;
}

.group-section {
	margin-bottom: 40rpx;
}

.section-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 30rpx;
}

.more-text {
	font-size: 32rpx;
	color: #999999;
}

.video-container {
	display: flex;
	justify-content: center;
	width: 100%;
	overflow: hidden;
}

.video-list {
	display: flex;
	white-space: nowrap;
	padding: 0 30rpx 20rpx;
	justify-content: center;
	align-items: center;
	width: 100%;
}

.video-card {
	background: #FFFFFF;
	border-radius: 20rpx;
	overflow: hidden;
	box-shadow: 0 4rpx 20rpx rgba(255, 107, 157, 0.1);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	/* width: 420rpx; */
	margin: 10rpx 20rpx;
	flex-shrink: 0;
}

.video-card:last-child {
	margin-right: 0;
}

.video-card:active {
	transform: scale(0.98);
	box-shadow: 0 2rpx 10rpx rgba(255, 107, 157, 0.2);
}

.video-thumbnail {
	position: relative;
	height: 280rpx;
}

.video-image {
	width: 100%;
	height: 100%;
	background: linear-gradient(45deg, #FF6B9D, #FFB6C1);
}

.video-overlay {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
	padding: 40rpx 30rpx 30rpx;
}

.video-title {
	color: #FFFFFF;
	font-size: 28rpx;
	font-weight: bold;
}

.video-subtitle {
	color: #FFFFFF;
	font-size: 24rpx;
	margin-top: 8rpx;
}

.video-duration {
	position: absolute;
	top: 15rpx;
	right: 15rpx;
	background: rgba(0, 0, 0, 0.7);
	color: #FFFFFF;
	font-size: 22rpx;
	padding: 8rpx 12rpx;
	border-radius: 8rpx;
}

.bottom-nav {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	background: #FFFFFF;
	display: flex;
	padding: 20rpx 0;
	box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.1);
}

.nav-item {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 10rpx 0;
}

.nav-item.active .nav-icon,
.nav-item.active .nav-text {
	color: #FF6B9D;
}

.nav-icon {
	font-size: 44rpx;
	margin-bottom: 8rpx;
	color: #999999;
}

.nav-text {
	font-size: 22rpx;
	color: #999999;
}
</style> 